<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:70:"F:\liudian\fly_forum\public/../application/index\view\Index\index.html";i:1520416906;s:53:"F:\liudian\fly_forum\application\index\view\base.html";i:1520410612;}*/ ?>


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $title; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="fly,layui,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="/fly_forum/public/static/layui/css/layui.css">
    <link rel="stylesheet" href="/fly_forum/public/static/home/css/global.css">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="<?php echo url('Index/index'); ?>">
            <img src="/fly_forum/public/static/home/images/logo.png" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="<?php echo url('Index/index'); ?>"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="#" onclick="WeAdminShow('在线直播','https://staticlive.douyucdn.cn/common/share/play.swf?room_id=85894')"><i class="iconfont icon-iconmingxinganli"></i>在线直播</a>
            </li>
            <li class="layui-nav-item">
                <a href="#" onclick="WeAdminShow('在线电影','http://www.cmmov.net/')"><i class="iconfont icon-ui"></i>在线影视</a>
            </li>
        </ul>

        <ul class="layui-nav fly-nav-user">

            
            <?php if(empty(\think\Session::get('home'))): ?>
                <!-- 未登入的状态 -->
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/login'); ?>"></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/login'); ?>">登入</a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/reg'); ?>">注册</a>
                </li>
            <?php else: ?>
                <!-- 登入后的状态 -->
                <li class="layui-nav-item">
                    <?php if(empty(\think\Session::get('home.image'))): ?>
                        <a class="iconfont icon-touxiang layui-hide-xs" href="<?php echo url('User/set'); ?>"></a>
                    <?php else: ?>
                        <a  href="<?php echo url('User/set'); ?>"><img style="height: 40px;width: 40px;border-radius: 20px" src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',session('home.image'),0); ?>"></a>
                    <?php endif; ?>

                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/set'); ?>"><?php echo \think\Session::get('home.name'); ?></a>
                </li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('User/loginOut'); ?>">退出</a>
                </li>
            <?php endif; if(empty(\think\Session::get('home'))): ?>
            <li class="layui-nav-item layui-hide-xs">
                <a href="<?php echo url('User/qqlogin'); ?>" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" title="QQ登入" class="iconfont icon-qq"></a>
            </li>
            <!-- <li class="layui-nav-item layui-hide-xs">
                <a href="/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" title="微博登入" class="iconfont icon-weibo"></a> -->
            </li>
            <?php else: endif; ?>

            
        </ul>
    </div>
</div>



<script src="/fly_forum/public/static/home/js/jquery-1.7.2.js"></script>
<script src="/fly_forum/public/static/layui/layui.js"></script>

<div class="fly-panel fly-column">
    <div class="layui-container">
        <ul class="layui-clear">
            <?php if(empty($category_id)): ?>
                <li class="layui-hide-xs layui-this"><a href="<?php echo url('Index/index'); ?>">首页</a></li>
            <?php else: ?>
                <li><a href="<?php echo url('Index/index'); ?>">首页</a></li>
            <?php endif; ?>
            <!-- 显示所有帖子分类 -->
            <?php if(!empty($cateInfo)): if(is_array($cateInfo) || $cateInfo instanceof \think\Collection || $cateInfo instanceof \think\Paginator): if( count($cateInfo)==0 ) : echo "" ;else: foreach($cateInfo as $key=>$val): if($val['id'] == $category_id): ?>
                <li class="layui-hide-xs layui-this"><a href="<?php echo url('Index/index',['category'=>$val['id']]); ?>"><?php echo $val['category_name']; ?></a></li>
            <?php else: ?>
                <li><a href="<?php echo url('Index/index',['category'=>$val['id']]); ?>"><?php echo $val['category_name']; ?></a></li>
            <?php endif; endforeach; endif; else: echo "" ;endif; endif; ?>

            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>


            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="<?php echo url('User/userCenter',['action'=>'send']); ?>">我发表的贴</a></li>
            <li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><a href="<?php echo url('User/userCenter',['action'=>'collection']); ?>">我收藏的贴</a></li>
        </ul>

        <div class="fly-column-right layui-hide-xs">
            <span class="fly-search"><i class="layui-icon"></i></span>
            <a href="<?php echo url('Card/newCard'); ?>" class="layui-btn">发表新帖</a>
        </div>
        <div class="layui-hide-sm layui-show-xs-block" style="margin-top: -10px; padding-bottom: 10px; text-align: center;">
            <a href="<?php echo url('Card/newCard'); ?>" class="layui-btn">发表新帖</a>
        </div>
    </div>
</div>

<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md8">
            <!--如果$category为no,就进入首页,显示置顶-->
            <?php if($category == 'no'): ?>
            <div class="fly-panel">
                <div class="fly-panel-title fly-filter">
                    <a>置顶</a>
                    <a href="#signin" class="layui-hide-sm layui-show-xs-block fly-right" id="LAY_goSignin" style="color: #FF5722;">去签到</a>
                </div>
                <ul class="fly-list">
                    <?php if(!empty($cardFirst)): if(is_array($cardFirst) || $cardFirst instanceof \think\Collection || $cardFirst instanceof \think\Paginator): if( count($cardFirst)==0 ) : echo "" ;else: foreach($cardFirst as $key=>$val): ?>
                                <li>
                                    <!--头像-->
                                    <a href="<?php echo url('User/home',['id'=>$val['user_id']]); ?>" class="fly-avatar">
                                        <?php if(empty($val['image'])): ?>
                                        <img src="/fly_forum/public/static/head.jpg" alt="<?php echo $val['username']; ?>">
                                        <?php else: ?>
                                        <img src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',$val['image'],0); ?>" alt="<?php echo $val['username']; ?>">
                                        <?php endif; ?>
                                    </a>
                                    <!--帖子类型 帖子标题--->
                                    <h2>
                                        <!--帖子类型-->
                                        <a class="layui-badge"><?php echo $val['category_name']; ?></a>
                                        <!--帖子标题-->
                                        <a href="<?php echo url('Card/cardBrowse?id='.$val['id']); ?>"><?php echo $val['name']; ?></a>
                                    </h2>
                                    <div class="fly-list-info">
                                        <!--用户名 用户等级-->
                                        <a href="<?php echo url('User/home',['id'=>$val['user_id']]); ?>" link>
                                            <!--用户名-->
                                            <cite><?php echo $val['username']; ?></cite>
                                            <!--用户等级-->
                                            <i class="layui-badge fly-badge-vip">
                                                <?php switch($val['level']): case "0": ?>普通用户<?php break; case "1": ?>VIP1<?php break; case "2": ?>VIP2<?php break; case "3": ?>VIP3<?php break; case "4": ?>VIP4<?php break; case "5": ?>VIP5<?php break; endswitch; ?>
                                            </i>
                                        </a>
                                        <!--发帖时间-->
                                        <span class="time"><?php echo $val['create_time']; ?></span>
                                        <!--悬赏金币-->
                                        <?php if($val['category_id'] == '1'): ?>
                                                    <span class="fly-list-kiss layui-hide-xs" title="悬赏金币">
                                                            <!--<i class="iconfont icon-kiss"></i>-->
                                                            <i class="layui-icon" style="font-size: 18px; color: red;">&#xe65e;</i>
                                                            <?php echo $val['gold']; ?></span>
                                        <?php endif; ?>
                                        <!--该提问帖是否已结-->
                                        <?php if($val['is_end'] == '2'): ?>
                                        <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
                                        <?php endif; ?>

                                        <!--评论数-->
                                                <span class="fly-list-nums ">
                                                    <?php if($val['category_id'] == '1'): ?>
                                                        <i class="iconfont icon-pinglun1" title="回答"></i> <?php echo $val['evaluate_num']; else: ?>
                                                        <i class="iconfont icon-pinglun1" title="评论"></i> <?php echo $val['evaluate_num']; endif; ?>
                                                </span>
                                    </div>
                                    <div class="fly-list-badge">
                                        <?php if($val['is_fine'] == '1'): ?>
                                        <span class="layui-badge layui-bg-red">精帖</span>
                                        <?php endif; ?>

                                    </div>
                                </li>
                        <?php endforeach; endif; else: echo "" ;endif; endif; ?>




                </ul>
            </div>
            <?php endif; ?>

            <div class="fly-panel" style="margin-bottom: 0;">

                <?php if($category == 'no'): ?>
                <div class="fly-panel-title fly-filter">
                    <?php if($fine == 'fine'): ?>
                        <a href="<?php echo url('Index/index'); ?>">综合</a>
                        <span class="fly-mid"></span>
                        <a href="<?php echo url('Index/index',['fine'=>'fine']); ?>" class="layui-this">精华</a>
                    <?php else: ?>
                        <a href="<?php echo url('Index/index'); ?>" class="layui-this">综合</a>
                        <span class="fly-mid"></span>
                        <a href="<?php echo url('Index/index',['fine'=>'fine']); ?>">精华</a>
                    <?php endif; ?>
            <span class="fly-filter-right layui-hide-xs">
                <?php if($action == 'byTime'): ?>
                    <a href="<?php echo url('Index/index'); ?>" class="layui-this">按最新</a>
                    <span class="fly-mid"></span>
                    <a href="<?php echo url('Index/index?action=byEvaluate'); ?>">按热议</a>
                <?php else: ?>
                    <a href="<?php echo url('Index/index'); ?>">按最新</a>
                    <span class="fly-mid"></span>
                    <a href="<?php echo url('Index/index?action=byEvaluate'); ?>" class="layui-this">按热议</a>
                <?php endif; ?>

            </span>
                </div>
                <?php else: ?>
                <div class="fly-panel-title fly-filter">
                    <?php if($fine == 'fine'): ?>
                    <a href="<?php echo url('Index/index',['category'=>$category_id]); ?>">综合</a>
                    <span class="fly-mid"></span>
                    <a href="<?php echo url('Index/index',['fine'=>'fine','category'=>$category_id]); ?>" class="layui-this">精华</a>
                    <?php else: ?>
                    <a href="<?php echo url('Index/index',['category'=>$category_id]); ?>" class="layui-this">综合</a>
                    <span class="fly-mid"></span>
                    <a href="<?php echo url('Index/index',['fine'=>'fine','category'=>$category_id]); ?>">精华</a>
                    <?php endif; ?>
                    <span class="fly-filter-right layui-hide-xs">
                        <?php if($action == 'byTime'): ?>
                            <a href="<?php echo url('Index/index',['category'=>$category_id]); ?>" class="layui-this">按最新</a>
                            <span class="fly-mid"></span>
                            <a href="<?php echo url('Index/index',['action'=>'byEvaluate','category'=>$category_id]); ?>">按热议</a>
                        <?php else: ?>
                            <a href="<?php echo url('Index/index',['category'=>$category_id]); ?>">按最新</a>
                            <span class="fly-mid"></span>
                            <a href="<?php echo url('Index/index',['action'=>'byEvaluate','category'=>$category_id]); ?>" class="layui-this">按热议</a>
                        <?php endif; ?>

                    </span>
                </div>
                <?php endif; ?>

                <ul class="fly-list">
                    <?php if(!empty($cardList)): if(is_array($cardList) || $cardList instanceof \think\Collection || $cardList instanceof \think\Paginator): if( count($cardList)==0 ) : echo "" ;else: foreach($cardList as $key=>$val): if($val['is_first'] == '0'): ?>
                            <li>
                                <!--头像-->
                                <a href="<?php echo url('User/home',['id'=>$val['user_id']]); ?>" class="fly-avatar">
                                    <?php if(empty($val['image'])): ?>
                                    <img src="/fly_forum/public/static/head.jpg" alt="<?php echo $val['username']; ?>">
                                    <?php else: ?>
                                    <img src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',$val['image'],0); ?>" alt="<?php echo $val['username']; ?>">
                                    <?php endif; ?>
                                </a>
                                <!--帖子类型 帖子标题--->
                                <h2>
                                    <!--帖子类型-->
                                    <a class="layui-badge"><?php echo $val['category_name']; ?></a>
                                    <!--帖子标题-->
                                    <a href="<?php echo url('Card/cardBrowse?id='.$val['id']); ?>"><?php echo $val['name']; ?></a>
                                </h2>
                                <div class="fly-list-info">
                                    <!--用户名 用户等级-->
                                    <a href="<?php echo url('User/home',['id'=>$val['user_id']]); ?>" link>
                                        <!--用户名-->
                                        <cite><?php echo $val['username']; ?></cite>
                                        <!--用户等级-->
                                        <i class="layui-badge fly-badge-vip">
                                            <?php switch($val['level']): case "0": ?>普通用户<?php break; case "1": ?>VIP1<?php break; case "2": ?>VIP2<?php break; case "3": ?>VIP3<?php break; case "4": ?>VIP4<?php break; case "5": ?>VIP5<?php break; endswitch; ?>
                                        </i>
                                    </a>
                                    <!--发帖时间-->
                                    <span class="time"><?php echo $val['create_time']; ?></span>
                                    <!--悬赏金币-->
                                    <?php if($val['category_id'] == '1'): ?>
                                        <span class="fly-list-kiss layui-hide-xs" title="悬赏金币">
                                                <!--<i class="iconfont icon-kiss"></i>-->
                                                <i class="layui-icon" style="font-size: 18px; color: red;">&#xe65e;</i>
                                                <?php echo $val['gold']; ?></span>
                                    <?php endif; ?>
                                    <!--该提问帖是否已结-->
                                    <?php if($val['is_end'] == '2'): ?>
                                        <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
                                    <?php endif; ?>

                                    <!--评论数-->
                                    <span class="fly-list-nums ">
                                        <?php if($val['category_id'] == '1'): ?>
                                            <i class="iconfont icon-pinglun1" title="回答"></i> <?php echo $val['evaluate_num']; else: ?>
                                            <i class="iconfont icon-pinglun1" title="评论"></i> <?php echo $val['evaluate_num']; endif; ?>
                                    </span>
                                </div>
                                <div class="fly-list-badge">
                                    <?php if($val['is_fine'] == '1'): ?>
                                        <span class="layui-badge layui-bg-red">精帖</span>
                                    <?php endif; ?>

                                </div>
                            </li>
                        <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                    <!--显示分页-->
                    <?php echo $cardPage; endif; ?>

                </ul>
                <div style="text-align: center">
                    <div class="laypage-main">
                        <!--<a href="jie/index.html" class="laypage-next">更多求解</a>-->
                    </div>
                </div>

            </div>
        </div>
        <div class="layui-col-md4">
            <div class="fly-panel fly-signin">
                <div class="fly-panel-title">
                    签到
                    <i class="fly-mid"></i>
                    <a href="javascript:;" class="fly-link" id="qdsm">说明</a>
                    <!-- <i class="fly-mid"></i> -->
                    <!-- <a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜 --><span class="layui-badge-dot"></span></a>
                    <span class="fly-signin-days">我的金币<cite><?php echo $gold_num; ?></cite>个</span>
                </div>
                <div class="fly-panel-main fly-signin-main">
                    <a   class="layui-btn layui-btn-danger" id="qd">今日签到</a>
                    <span>可获得<cite>5</cite>金币</span>
<script type="text/javascript">
        $(function(){
            $("#qd").click(function(){
                //将时间转化成时间戳
                layer.msg('正在签到', {icon:16, shade: 0.1, time:0})
                // var time = Date.parse(new Date($(this).text()));
                $.ajax({
                    type: "get",
                    data: '',
                    dataType: 'json',
                    url: "<?php echo url('index/qd'); ?>",
                    success: function (data) {
                        if (data.status == 1) {
                            layer.msg('签到成功');
                        } else if(data.status == 0) {
                            layer.msg('亲,今天已经签到过啦!');
                        }else{
                            layer.msg('未知错误');

                        }
                    }
                })
                
            })

            $("#qdsm").click(function(){
                //自定页
                //捕获页
                
                    layer.msg('我是每日签到说明 ☆￣(＞。☆)', {time: 5000, icon:6});
                  

            })
        })


</script>
                    <!-- 已签到状态 -->
                    <!--
                    <button class="layui-btn layui-btn-disabled">今日已签到</button>
                    <span>获得了<cite>20</cite>飞吻</span>
                    -->
                </div>
            </div>

            <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
                <h3 class="fly-panel-title">回贴周榜</h3>
                <dl>
                    <!--<i class="layui-icon fly-loading">&#xe63d;</i>-->
                    <?php if(is_array($timeList) || $timeList instanceof \think\Collection || $timeList instanceof \think\Paginator): if( count($timeList)==0 ) : echo "" ;else: foreach($timeList as $key=>$vo): ?>
                    <dd>
                        <a href="<?php echo url('User/home',['id'=>$vo['user_id']]); ?>">
                            <img src="<?php echo get_img_url('/fly_forum/public/static/../upload/headImg/',$vo['image'],0); ?>"><cite><?php echo $vo['name']; ?></cite><i><?php echo $vo['count']; ?>次回答</i>
                        </a>
                    </dd>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                    
                </dl>
            </div>

            <dl class="fly-panel fly-list-one">
                <dt class="fly-panel-title">本周热议</dt>
                <?php if(is_array($hotList) || $hotList instanceof \think\Collection || $hotList instanceof \think\Paginator): if( count($hotList)==0 ) : echo "" ;else: foreach($hotList as $key=>$vo): ?>
                <dd>
                    <a href="<?php echo url('Card/cardBrowse?id='.$vo['id']); ?>"><?php echo $vo['name']; ?></a>
                     <span><i class="iconfont icon-pinglun1"></i> <?php echo $vo['browse']; ?></span>
                </dd>
                <?php endforeach; endif; else: echo "" ;endif; ?>
                <!-- 无数据时 -->
                <!--
                <div class="fly-none">没有相关数据</div>
                -->
            </dl>

            <div class="fly-panel">
                <div class="fly-panel-title">
                    最新推荐
                </div>
                <div class="fly-panel-main">
                    <a href="http://layim.layui.com/" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;"> layui前端模版制作</a>
                </div>
            </div>

            <div class="fly-panel fly-link">
                <h3 class="fly-panel-title">友情链接</h3>
                <dl class="fly-panel-main">

                    <?php if(is_array($linkList) || $linkList instanceof \think\Collection || $linkList instanceof \think\Paginator): if( count($linkList)==0 ) : echo "" ;else: foreach($linkList as $key=>$vo): ?>
                    <dd><a href="<?php echo $vo['lurl']; ?>" target="_blank"><?php echo $vo['lname']; ?></a><dd>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                
                    <!-- <dd><a href="mailto:xianxin@layui-inc.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a><dd> -->
                </dl>
            </div>

        </div>
    </div>
</div>

<div class="fly-footer">
    <p><a href="#">Fly社区</a> 2018 &copy; <a href="#"></a></p>
    <p>
        <a href="http://www.layui.com/template/fly/" target="_blank">前端框架:Fly社区模版/LAYUI</a>
        <a href="https://github.com/top-think/think" target="_blank">后端框架:TP5</a>
    </p>
</div>

<script>
    $(function(){
        $(".time").each(function(){
            //将时间转化成时间戳
            var time = Date.parse(new Date($(this).text()));
            time = time/ 1000;
            //当前时间
            var newtime = Date.parse(new Date());
            newtime = newtime/ 1000;
            var diff = newtime-time;
//            console.log(newtime);
//            console.log(time);
//            console.log(newtime - time);
            if(diff < 3600){
                $(this).text("刚刚");
            }else if(diff > 3600 && diff <= 86400){ // 1小时 - 5小时
                $(this).text("一小时前");
            }else if(diff > 86400 && diff <= 2592000){ //
                $(this).text("一天前");
            }else if(diff > 2592000 && diff <= 946080000){
                $(this).text("一月前");
            }else if(diff > 946080000){
                $(this).text("一年前");
            }
        })
    })
</script>

<script>
    layui.cache.page = '';
    layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '/fly_forum/public/static/home/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
    };
    layui.config({
        version: "3.0.0"
        ,base: '/fly_forum/public/static/home/mods/' //这里实际使用时，建议改成绝对路径
    }).extend({
        fly: 'index'
    }).use('fly');



    /*
     * @todo 弹出层，弹窗方法
     * layui.use 加载layui.define 定义的模块，当外部 js 或 onclick调用 use 内部函数时，需要在 use 中定义 window 函数供外部引用
     * http://blog.csdn.net/xcmonline/article/details/75647144 
     */
    /*
        参数解释：
        title   标题
        url     请求的url
        id      需要操作的数据id
        w       弹出层宽度（缺省调默认值）
        h       弹出层高度（缺省调默认值）
    */
    window.WeAdminShow = function(title, url, w, h) {
        if(title == null || title == '') {
            title = false;
        };
        if(url == null || url == '') {
            url = "404.html";
        };
        if(w == null || w == '') {
            w = ($(window).width() * 0.9);
        };
        if(h == null || h == '') {
            h = ($(window).height() - 50);
        };
        layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade: 0.4,
            title: title,
            content: url
        });
    }
</script>

<!-- <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script> -->

</body>
</html>